import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';

import 'package:get/get.dart';

import '../../../style/app_colors.dart';
import '../../../style/widget_style.dart';
import '../../../widgets/AppHeader.dart';
import '../../../widgets/CommonWidgets.dart';
import '../../listenerTranslation/controllers/listener_translation_controller.dart';
import '../controllers/listening_trans_landscape_controller.dart';

class ListeningTransLandscapeView
    extends GetView<ListeningTransLandscapeController> {
  const ListeningTransLandscapeView({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Stack(
          children: [
            Container(
              child: SvgPicture.asset(
                "assets/images/header_part_bg.svg",
                width: controller.screenHeight,
                fit: BoxFit.fitWidth,
              ),
            ),
            AppHeader.obtainHeaderForListenTranslationForLandscape(controller.screenWidth,controller.screenHeight),
            Container(
              width: controller.screenHeight,
              margin: EdgeInsets.only(top: 50.h),
              padding: EdgeInsets.all(20.w),
              child: Column(
                children: [
                  InkWell(
                    onTap: () {
                      controller.showPoupWindow(context);
                    },
                    child: Container(
                      width: controller.screenHeight,
                      height: controller.screenWidth-130.h,
                      margin: EdgeInsets.only(bottom: 20.h),
                      decoration: BoxDecoration(
                        boxShadow: [
                          CommonWidgets.getBoxShadow(),
                        ],
                        color:  Colors.white,
                        borderRadius: BorderRadius.only(topLeft: Radius.circular(8),topRight: Radius.circular(8)), // Optional: add border radius
                      ),
                      child: Obx(()=>Stack(
                        children: [
                          Container(
                            width: controller.screenHeight,
                            padding: EdgeInsets.all(20.w),
                            child: controller.listenerTranslationController!.audioService.finalFromLanguage.value != ''? SingleChildScrollView(
                                controller: controller.fromController,
                                child: Text(controller.listenerTranslationController!.audioService.finalFromLanguage.value + '\n' +
                                    controller.listenerTranslationController!.audioService.finalToLanguage.value,style: TextStyle(
                                    color: AppColors.hint_text_color.withValues(alpha: 0.4),
                                    fontSize: controller.listenerTranslationController!.fontSize.value.sp
                                ),)) :
                            Center(
                              child: Column(
                                children: [
                                  Image.asset('assets/images/empty_list_realtime.png',width: 169.h,height: 91.w),
                                  SizedBox(height: 16.h,),
                                  Text('点击下方开始键开始听译',style: AppStyleThemeData.HINT_TEXT_STYLE_small,)

                                ],
                              ),
                            ),
                          )

                        ],
                      )),
                    ),
                  ),
                ],
              ),
            )
          ],
        )
    );
  }
}
